<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Demo11</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/3.0.2/vue.global.js"></script>
</head>

<body>
    <div id="app"></div>
    
</body>
<script>
    const app = Vue.createApp({
        data() {
            return {
                showcom:'dajiao'
            }
        },
        methods: {
            cli(){
                this.showcom= this.showcom=='dajiao'?'liuying':'dajiao'
            }
        },
        //keep-alive标签 让里面的东西能一直存在不消失
        template: ` 
            <h2>欢迎光临红浪漫-请选择您的技师</h2> 
            <keep-alive>
    <component :is="showcom" />
</keep-alive>
        <div><button @click="cli">切换</button></div>
        `
    })
    app.component('dajiao',{
        template:`<input />`
})

app.component('liuying',{
    template:`<img src="https://newimg.jspang.com/liuying01.jpg" />`
})
    const vm = app.mount("#app")
</script>